package com.yuntsg.nnsfcp.util;

import com.fasterxml.jackson.databind.ObjectMapper;

public class JacksonUtil {

    private final static ObjectMapper objectMapper = new ObjectMapper();

    /*private JacksonUtil() {

    }*/

    /*public static ObjectMapper getInstance() {
        return objectMapper;
    }*/
    /**
     * javaBean、列表数组转换为json字符串
     */
    /*public static String obj2json(Object obj) throws Exception {
        return objectMapper.writeValueAsString(obj);
    }

    *//**
     * json 转JavaBean
     *//*

    public static <T> T json2pojo(String jsonString, Class<T> clazz) throws Exception {
        objectMapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true);
        return objectMapper.readValue(jsonString, clazz);
    }

    *//**
     * json字符串转换为map
     *//*
    public static <T> Map<String, Object> json2map(String jsonString) throws Exception {
        ObjectMapper mapper = new ObjectMapper();
        mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
        return mapper.readValue(jsonString, Map.class);
    }*/
}
